<template>
    <div class="app-container">
      <wise-crud
        ref="wise-crud"
        :urls="urls"
        :fields="fields"
        :handle="handle"
        :filters="filters"
      />
    </div>
  </template>
  <script>
  
  import WiseCrud from '@/components/Crud/wiseCrud'
  
  import checkPermission from '@/pages/index/utils/permission'
  export default {
    name: 'VideoManage',
    components: { WiseCrud },
    data() {
      return {
        urls: {
          list: '/api/v1/welder-sbtx-second/video-comb/listqy',
          add: '/api/v1/welder-sbtx-second/video-comb/create',
          show: '/api/v1/welder-sbtx-second/video/show/',
          update: '/api/v1/welder-sbtx-second/video-comb/update/',
          delete: '/api/v1/welder-sbtx-second/video/remove/'
        }
      }
    },
    computed: {
      spaceId() {
        return this.$store.state.project.spaceId
      },
      handle() {
        return []
    
             
         
      },
      fields() {
        let arr = [{ label: '序号', type: 'index', use: ['table'] }]
        if (this.$store.state.user.project) {
          arr.push({
            prop: 'projectId',
            
            use: ['add', 'edit']
          })
        } else {
   
        }
        arr.push(
          {
            label: '视频名称',
            prop: 'name',
            type: 'text',
            labelWidth: '130px',
            rules: [
              { required: true, message: '请输入视频名称', trigger: 'change' }
            ],
            placeholder: '请输入视频名称',
            use: ['table', 'add', 'view', 'edit', 'search']
          },
          {
            label: '视频URL地址',
            prop: 'url',
            type: 'text',
            labelWidth: '130px',
            rules: [
              { required: true, message: '请输入视频URL地址', trigger: 'change' }
            ],
            placeholder: '请输入视频URL地址',
            use: ['table',  'view',   'search']
          },
          {
            label: 'appKey',
            prop: 'appKey',
            type: 'text',
            labelWidth: '130px',
            rules: [
              { required: true, message: '请输入appKey', trigger: 'change' }
            ],
            placeholder: '请输入appKey',
            use: [   'view',  'search']
          },
          {
            label: 'appSecret',
            prop: 'appSecret',
            type: 'text',
            labelWidth: '130px',
            rules: [
              { required: true, message: '请输入appSecret', trigger: 'change' }
            ],
            placeholder: '请输入appSecret',
            use: [   'view',   'search']
          },
          {
            label: '设备序列号',
            prop: 'deviceSerial',
            type: 'text',
            labelWidth: '130px',
            rules: [
              { required: true, message: '请输入设备序列号', trigger: 'change' }
            ],
            placeholder: '请输入设备序列号',
            use: ['table', 'add', 'view', 'edit', 'search']
          },
          {
            label: '所属项目',
            prop: 'projectInfo.name',
            type: 'text',
            labelWidth: '130px',
         
            use: ['table',  'view' , 'search']
          },
          //内网去除
          // {
          //   label: '通道号',
          //   prop: 'channelNo',
          //   type: 'number',
          //   labelWidth: '130px',
          //   rules: [
          //     { required: true, message: '请输入通道号', trigger: 'change' }
          //   ],
          //   placeholder: '请输入通道号',
          //   use: [ 'add', 'view', 'edit', 'search']
          // },
          {
            label: '摄像头类型',
            prop: 'typeCode',
            type: 'radio',
            dataDic: 'cameraType',
            labelWidth: '130px',
            use: ['table', 'view', 'search']
          },
          {
            label: '摄像头类型',
            prop: 'typeCodeObj',
            type: 'select',
            dataDic: 'cameraType',
            labelWidth: '130px',
            rules: [
              { required: true, message: '请选择摄像头类型', trigger: 'change' }
            ],
            objKeys: [
              {
                field: 'typeCode',
                key: 'value'
              }
            ],
            placeholder: '请选择摄像头类型',
            use: ['add', 'edit']
          },
          {
            label: '视频顺序',
            prop: 'sequence',
            type: 'number',
            labelWidth: '130px',
            rules: [
              { required: true, message: '请输入视频顺序', trigger: 'change' }
            ],
            placeholder: '请输入视频顺序',
            use: ['table', 'add', 'view', 'edit', 'search']
          },{
            label: '内网视频地址',
            prop: 'nwurl',
            type: 'text',
            labelWidth: '130px',
            rules: [
              { required: true, message: '请输入视频顺序', trigger: 'change' }
            ],
            placeholder: '请输入视频顺序',
            use: ['table', 'add', 'view', 'edit', 'search']
          },
          //内网去除
          // {
          //   label: '内网通道号',
          //   prop: 'nwtd',
          //   type: 'number',
          //   labelWidth: '130px',
          //   rules: [
          //     { required: true, message: '请输入视频顺序', trigger: 'change' }
          //   ],
          //   placeholder: '请输入视频顺序',
          //   use: ['table', 'add', 'view', 'edit', 'search']
          // },
          {
            prop: 'spaceId',
            
            use: ['add', 'edit']
          }
        )
   
  
          arr.push({
          label: '操作',
          type: 'handle',
          use: ['table'],
          handle: ['view'],
          tableWidth: 300
        })
        
       
        return arr
      },
      filters() {
        return [
          {
            field: 'spaceId',
            operator: 'EQUALS',
            spaceId:this.$store.state.spaceId
          }
        ]
      }
    },
    methods: {
      checkPermission,
    }
  }
  </script>
  
  <style>
  </style>
  